// 判断一个整数是不是3的幂
// 测试链接 : https://leetcode.cn/problems/power-of-three/
public class PowerOfThree {
    public static void main(String[] args) {
        isPowerOfThree(3);
    }


    public static boolean isPowerOfThree(int n) {
        if( n < 1) {
            return false;
        }
        int num = 1;
        while (Math.pow(3,num) < Integer.MAX_VALUE) {
            num++;
        }
        System.out.println(num);
        num = (int)Math.pow(3,num-1);
        System.out.println(num);
        return num%3 == 0;
    }
}
